<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //3. 命令式变为函数行为
        let obj = {
            name: "twj"
        }
        //查询对象中是否存在某个属性：老写法
        console.log("name" in obj) //true
        //新写法
        console.log(Reflect.has(obj, "name")) //true
        //删除属性：老写法
        //delete obj.name
        //新写法
        Reflect.deleteProperty(obj, "name")
        console.log(Reflect.has(obj, "name")) //false
        Reflect.set(obj, "age", 100) //在obj上添加一个属性age，赋值为100
        console.log(Reflect.get(obj, "age")) //获取obj上age属性值


    </script>
</body>

</html>